VERSION 5.00
Begin VB.Form Settings 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Settings"
   ClientHeight    =   3300
   ClientLeft      =   3570
   ClientTop       =   4230
   ClientWidth     =   4995
   ControlBox      =   0   'False
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   NegotiateMenus  =   0   'False
   Picture         =   "Form2.frx":0000
   ScaleHeight     =   3300
   ScaleWidth      =   4995
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton cmdApply 
      Caption         =   "Apply"
      Height          =   375
      Left            =   3600
      Picture         =   "Form2.frx":0D75
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   2640
      Width           =   1095
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "Cancel"
      Height          =   375
      Left            =   3600
      Picture         =   "Form2.frx":1AEA
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   2160
      Width           =   1095
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "OK"
      Height          =   375
      Left            =   3600
      MaskColor       =   &H00FFFFFF&
      Picture         =   "Form2.frx":285F
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   1680
      Width           =   1095
   End
   Begin VB.PictureBox picOptions 
      BorderStyle     =   0  'None
      Height          =   3720
      Index           =   0
      Left            =   0
      Picture         =   "Form2.frx":35D4
      ScaleHeight     =   248
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   500
      TabIndex        =   3
      TabStop         =   0   'False
      Top             =   0
      Width           =   7500
      Begin VB.TextBox Text1 
         Height          =   285
         Left            =   240
         TabIndex        =   18
         Text            =   "Text1"
         Top             =   480
         Width           =   4455
      End
      Begin VB.Frame Frame1 
         Appearance      =   0  'Flat
         BackColor       =   &H00FFF5EA&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   375
         Left            =   240
         TabIndex        =   14
         Top             =   840
         Width           =   4500
         Begin VB.OptionButton Option4 
            BackColor       =   &H80000014&
            Caption         =   "My Documents"
            DownPicture     =   "Form2.frx":765EE
            Height          =   375
            Left            =   0
            Picture         =   "Form2.frx":76634
            Style           =   1  'Graphical
            TabIndex        =   17
            Top             =   0
            UseMaskColor    =   -1  'True
            Width           =   1500
         End
         Begin VB.OptionButton Option5 
            BackColor       =   &H80000014&
            Caption         =   "Desktop"
            DownPicture     =   "Form2.frx":773A9
            Height          =   375
            Left            =   1500
            Picture         =   "Form2.frx":773EF
            Style           =   1  'Graphical
            TabIndex        =   16
            Top             =   0
            Width           =   1500
         End
         Begin VB.OptionButton Option6 
            Appearance      =   0  'Flat
            BackColor       =   &H80000005&
            Caption         =   "Custom"
            DownPicture     =   "Form2.frx":78164
            ForeColor       =   &H80000008&
            Height          =   375
            Left            =   3000
            Picture         =   "Form2.frx":781AA
            Style           =   1  'Graphical
            TabIndex        =   15
            Top             =   0
            Width           =   1500
         End
      End
      Begin VB.TextBox Text2 
         Alignment       =   1  'Right Justify
         Height          =   285
         Left            =   240
         TabIndex        =   13
         Text            =   "Text2"
         Top             =   1560
         Width           =   1575
      End
      Begin VB.TextBox Text3 
         Height          =   285
         Left            =   2040
         TabIndex        =   12
         Text            =   "Text3"
         Top             =   1560
         Width           =   1095
      End
      Begin VB.Frame Frame2 
         Height          =   1125
         Left            =   240
         TabIndex        =   8
         Top             =   1920
         Width           =   1575
         Begin VB.OptionButton Option7 
            BackColor       =   &H80000014&
            Caption         =   "Default"
            DownPicture     =   "Form2.frx":78F1F
            Height          =   375
            Left            =   0
            Picture         =   "Form2.frx":78F65
            Style           =   1  'Graphical
            TabIndex        =   11
            Top             =   0
            Width           =   1575
         End
         Begin VB.OptionButton Option8 
            BackColor       =   &H80000014&
            Caption         =   "TimeStamp"
            DownPicture     =   "Form2.frx":79CDA
            Height          =   375
            Left            =   0
            Picture         =   "Form2.frx":79D20
            Style           =   1  'Graphical
            TabIndex        =   10
            Top             =   375
            Width           =   1575
         End
         Begin VB.OptionButton Option9 
            BackColor       =   &H80000014&
            Caption         =   "Custom"
            DownPicture     =   "Form2.frx":7AA95
            Height          =   375
            Left            =   0
            Picture         =   "Form2.frx":7AADB
            Style           =   1  'Graphical
            TabIndex        =   9
            Top             =   750
            Width           =   1575
         End
      End
      Begin VB.Frame Frame3 
         BackColor       =   &H80000014&
         Height          =   1125
         Left            =   2040
         TabIndex        =   4
         Top             =   1920
         Width           =   1095
         Begin VB.OptionButton Option10 
            BackColor       =   &H80000014&
            Caption         =   "Default"
            DownPicture     =   "Form2.frx":7B850
            Height          =   375
            Left            =   0
            Picture         =   "Form2.frx":7B896
            Style           =   1  'Graphical
            TabIndex        =   7
            Top             =   0
            Width           =   1095
         End
         Begin VB.OptionButton Option11 
            BackColor       =   &H80000014&
            Caption         =   "TXT"
            DownPicture     =   "Form2.frx":7C60B
            Height          =   375
            Left            =   0
            Picture         =   "Form2.frx":7C651
            Style           =   1  'Graphical
            TabIndex        =   6
            Top             =   375
            Width           =   1095
         End
         Begin VB.OptionButton Option12 
            BackColor       =   &H80000014&
            Caption         =   "Custom"
            DownPicture     =   "Form2.frx":7D3C6
            Height          =   375
            Left            =   0
            Picture         =   "Form2.frx":7D40C
            Style           =   1  'Graphical
            TabIndex        =   5
            Top             =   750
            Width           =   1095
         End
      End
      Begin VB.Label Label4 
         BackStyle       =   0  'Transparent
         Caption         =   "Saved File Name:"
         Height          =   255
         Left            =   240
         TabIndex        =   21
         Top             =   1320
         Width           =   1335
      End
      Begin VB.Label Label1 
         BackColor       =   &H80000014&
         BackStyle       =   0  'Transparent
         Caption         =   "Saved Location:"
         Height          =   255
         Left            =   240
         TabIndex        =   20
         Top             =   120
         Width           =   1215
      End
      Begin VB.Label Label2 
         BackColor       =   &H80000014&
         BackStyle       =   0  'Transparent
         Caption         =   "."
         Height          =   375
         Left            =   1920
         TabIndex        =   19
         Top             =   1560
         Width           =   135
      End
   End
End
Attribute VB_Name = "Settings"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Const BIF_RETURNONLYFSDIRS = 1
Private Const BIF_DONTGOBELOWDOMAIN = 2
Private Const MAX_PATH = 260

Private Declare Function SHBrowseForFolder Lib _
"shell32" (lpbi As BrowseInfo) As Long

Private Declare Function SHGetPathFromIDList Lib _
"shell32" (ByVal pidList As Long, ByVal lpBuffer _
As String) As Long

Private Declare Function lstrcat Lib "kernel32" _
Alias "lstrcatA" (ByVal lpString1 As String, ByVal _
lpString2 As String) As Long

Dim diradd2 As String
Dim filename2 As String
Dim fileext2 As String
Dim sync2 As String
Dim del2 As String
Dim Time As String

Private Type BrowseInfo
   hWndOwner As Long
   pIDLRoot As Long
   pszDisplayName As Long
   lpszTitle As Long
   ulFlags As Long
   lpfnCallback As Long
   lParam As Long
   iImage As Long
End Type



Private Sub cmdApply_Click()
    Open "settings.ini" For Output As #2
    Print #2, sync2
    Print #2, del2
    
    If Text1.Text = Form1.fGetSpecialFolder(5) Then
        Print #2, "My Docunments"
        Form1.diradd = "My Docunments"
    ElseIf Text1.Text = Form1.fGetSpecialFolder(16) Then
        Print #2, "Desktop"
        Form1.diradd = "Desktop"
    Else
        Print #2, Text1.Text
        Form1.diradd = Text1.Text
    End If
    If (StrComp(Left$(Text2.Text, 8), Left$(Time, 8), vbTextCompare)) = 0 Then
        Print #2, "%T"
        Form1.filename = "%T"
    Else
        Print #2, Text2.Text
        Form1.filename = Text2.Text
    End If
    
    Print #2, Text3.Text
    
    Form1.fileext = Text3.Text

    Close #2
End Sub

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
    Open "settings.ini" For Output As #2
    Print #2, sync2
    Print #2, del2
    
    If Text1.Text = Form1.fGetSpecialFolder(5) Then
        Print #2, "My Docunments"
        Form1.diradd = "My Docunments"
    ElseIf Text1.Text = Form1.fGetSpecialFolder(16) Then
        Print #2, "Desktop"
        Form1.diradd = "Desktop"
    Else
        Print #2, Text1.Text
        Form1.diradd = Text1.Text
    End If
    If (StrComp(Left$(Text2.Text, 8), Left$(Time, 8), vbTextCompare)) = 0 Then
        Print #2, "%T"
        Form1.filename = "%T"
    Else
        Print #2, Text2.Text
        Form1.filename = Text2.Text
    End If
    
    Print #2, Text3.Text
    
    Form1.fileext = Text3.Text

    Close #2
    Unload Me
End Sub

Private Sub Form_Load()
    'center the form
    Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
    sync2 = Form1.sync
    del2 = Form1.del
    diradd2 = Form1.diradd
    filename2 = Form1.filename
    fileext2 = Form1.fileext
    'Dim variable1 As String
    Open "settings.ini" For Input As #1
    Input #1, sync2
    Input #1, del2
    Input #1, diradd2
    Input #1, filename2
    Input #1, fileext2
    Close #1
    

    'Dir1.Path = diradd
    If filename2 = "FORM" Then
        Option7.Value = True
        Text2.Text = "FORM"
    ElseIf filename2 = "%T" Then
        Option8.Value = True
        Time = Form1.SetDate
        Text2.Text = Time
    Else
        Option9.Value = True
        Text2.Text = filename2
    End If
    
    If fileext2 = "DAT" Then
        Option10.Value = True
    ElseIf fileext2 = "TXT" Then
        Option11.Value = True
    Else
        Option12.Value = True
    End If
    Text3.Text = fileext2
    
    'If diradd2 = Form1.fGetSpecialFolder(5) Then
    '    Option4.Value = True
    'ElseIf diradd2 = Form1.fGetSpecialFolder(16) Then
    '    Option5.Value = True
    'Else
    '    Option6.Value = True
    'End If
    If diradd2 = "My Docunments" Then
        Option4.Value = True
        Text1.Text = Form1.fGetSpecialFolder(5)
    ElseIf diradd2 = "Desktop" Then
        Option5.Value = True
        Text1.Text = Form1.fGetSpecialFolder(16)
    Else
        Option6.Value = True
        Text1.Text = diradd2
    End If
    
End Sub

Private Sub Option4_Click()
    Text1.Text = Form1.fGetSpecialFolder(5)
    diradd2 = "My Docunments"
End Sub

Private Sub Option5_Click()
    Text1.Text = Form1.fGetSpecialFolder(16)
    diradd2 = "Desktop"
End Sub

'Private Sub Option6_Click()
Private Sub Option6_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    'Text1.Text = diradd
    'Form2.Show
    'Opens a Browse Folders Dialog Box that displays the
'directories in your computer
Dim lpIDList As Long ' Declare Varibles
Dim sBuffer As String
Dim szTitle As String
Dim tBrowseInfo As BrowseInfo

szTitle = "Choose a folder:"
'szTitle = "Hello World. Click on a directory and " & _
'"it's path will be displayed in a message box"
' Text to appear in the the gray area under the title bar
' telling you what to do

With tBrowseInfo
   .hWndOwner = Me.hWnd ' Owner Form
   .lpszTitle = lstrcat(szTitle, "")
   .ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN
End With

lpIDList = SHBrowseForFolder(tBrowseInfo)

If (lpIDList) Then
   sBuffer = Space(MAX_PATH)
   SHGetPathFromIDList lpIDList, sBuffer
   sBuffer = Left(sBuffer, InStr(sBuffer, vbNullChar) - 1)
   'MsgBox sBuffer
   Text1.Text = sBuffer
End If

End Sub

Private Sub Option7_Click()
    Text2.Text = "FORM"
    filename2 = "FORM"
End Sub

Private Sub Option8_Click()
    'time = Year(Now) & Month(Now) & Day(Now) & Hour(Now) & Minute(Now) & Second(Now)
    Time = Form1.SetDate
    Text2.Text = Time
    filename2 = "%T"
End Sub

Private Sub Option9_Click()
    'Text2.Text = filename
End Sub

Private Sub Option10_Click()
    Text3.Text = "DAT"
    fileext2 = "DAT"
End Sub

Private Sub Option11_Click()
    Text3.Text = "TXT"
    fileext2 = "TXT"
End Sub

Private Sub Option12_Click()
    'Text3.Text = fileext
End Sub


Private Sub Text1_Change()
    If Text1.Text <> Form1.fGetSpecialFolder(5) And Text1.Text <> Form1.fGetSpecialFolder(16) Then
        'Option6.Value = True
    End If
End Sub

Private Sub Text2_Change()
    If Text2.Text <> "FORM" And Text2.Text <> Time Then
        Option9.Value = True
    End If
End Sub

Private Sub Text3_Change()
    If Text3.Text <> "DAT" And Text3.Text <> "TXT" Then
        Option12.Value = True
    End If
End Sub
